<% layout('/layouts/default.html', {title: '文件分发管理', libs: ['validate']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header with-border">
            <div class="box-title">
                <i class="fa icon-note"></i> ${text(docDeliverRecord.isNewRecord ? '新增文件分发' : '编辑文件已分发')}
            </div>
            <div class="box-tools pull-right">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
            </div>
        </div>
        <#form:form id="inputForm" model="${docDeliverRecord}" action="${ctx}/sd/docDeliverTake/save" method="post" class="form-horizontal">
        <div class="box-body">
            <div class="form-unit">${text('基本信息')}

            </div>
            <#form:hidden path="id"/>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required "></span> ${text('来文编号')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="docId" maxlength="64" readonly="true" class="form-control required"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required "></span> ${text('文件分发后的编号')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="docCopyNo" maxlength="4" readonly="true" class="form-control required digits"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('截止领取日期')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="beforeTakeDate" readonly="true" maxlength="20" class="form-control"
                            dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('截止归还日期')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="beforeReturnDate" readonly="true" maxlength="20" class="form-control "
                            dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('收文单位名称')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="office.officeName" readonly="true" maxlength="64" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('分发类型')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:select path="deliverType" readonly="true" dictType="sd_doc_deliver_type" blankOption="true" class="form-control" />
                        </div>
                    </div>
                </div>
                <div id="take">

                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span>
                            <% if(docDeliverRecord.deliverType=="2"){%>
                            ${text('领文时间')}：
                            <% }%>
                            <% if(docDeliverRecord.deliverType=="3"){%>
                            ${text('送文时间')}：
                            <% }%>
                            <i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="takeDate" id="takeDate" readonly="true" maxlength="20" class="form-control"
                            dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
                        </div>
                    </div>
                </div>
                    <% if(docDeliverRecord.deliverType!="3"){%>


                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('领文人编号')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="takeUserCode" readonly="true" maxlength="64" class="form-control"/>
                        </div>
                    </div>
                </div>
                 <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('领文人姓名')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="takeUserName" readonly="true" maxlength="50" class="form-control"/>
                        </div>
                    </div>
                 </div>

                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('领文人警号')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="takeUserPoliceno" readonly="true" maxlength="50" class="form-control"/>
                        </div>
                    </div>
                </div>
                </div>
            </div>
            <% }%>
               <!-- <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('领文人脸识别图片路径')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="takeUserFace" readonly="true" maxlength="1000" class="form-control"/>
                        </div>
                    </div>
                </div>-->
               <div id="return">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('归还日期')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="returnDate" id="returnDate" readonly="true" maxlength="20" class="form-control"
                            dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('归还人编号')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="returnUserCode" maxlength="64" readonly="true" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('归还人姓名')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="returnUserName" maxlength="50" readonly="true" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide"></span> ${text('归还人警号')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="returnUserPoliceno" maxlength="50" readonly="true" class="form-control"/>
                        </div>
                    </div>
                </div>
               </div>
            <!--    <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('归还人脸识别图片路径')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="returnUserFace" maxlength="1000" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('销毁任务编号')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="destroyTaskId" maxlength="64" class="form-control"/>
                        </div>
                    </div>
                </div>-->
            </div>
        </div>
        <div class="box-footer">
            <div class="row">
                <div class="col-sm-offset-2 col-sm-10">
                 <!--   <% if (hasPermi('sd:docDeliverTake:edit')){ %>
                    <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
                    <% } %>-->
                    <button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
                </div>
            </div>
        </div>
    </#form:form>
</div>
</div>
<% } %>
<script>
    window.onload=function(){
       // document.getElementById("takeDate")
      var val=  $("#takeDate").val();
        var ret=  $("#returnDate").val();

      if (val===""){
          $("#take").css("display","none")
          $("#return").css("display","none")
         // js.layer.msg("未领")
      }else if (ret==""){
          $("#return").css("display","none")
        //  js.layer.msg("已领,未还")
      }else{
          $("#return").css("display","block")
          //js.layer.msg("已还")
      }
    }

    $("#inputForm").validate({
        submitHandler: function(form){
            js.ajaxSubmitForm($(form), function(data){
                js.showMessage(data.message);
                if(data.result == Global.TRUE){
                    js.closeCurrentTabPage(function(contentWindow){
                        contentWindow.page();
                    });
                }
            }, "json");
        }
    });
</script>